@extends('layouts.app', ['activePage' => 'extended', 'menuParent' => 'contato', 'titlePage' => __('Ler contato '.$data->id)])

@section('content')
    <div class="content">
        <div class="container-fluid">
            <div class="row">

                <div class="col-md-12">
                    <div class="card ">
                        <div class="card-header card-header-rose card-header-text">
                            <div class="card-text">
                                <h4 class="card-title">Ler contato {{$data->id}}</h4>
                            </div>
                        </div>
                        <div class="card-body ">

                            <div class="row">
                                <label class="col-sm-2 col-form-label">Nome</label>
                                <div class="col-sm-10">
                                    {{$data->name}}
                                </div>
                            </div>
                            <div class="row">
                                <label class="col-sm-2 col-form-label">Email</label>
                                <div class="col-sm-10">
                                    {{$data->email}}
                                </div>
                            </div>
                            <div class="row">
                                <label class="col-sm-2 col-form-label">Data</label>
                                <div class="col-sm-10">
                                    {{date_format($data->created_at,'d/m/Y')}}
                                </div>
                            </div>
                            <div class="row">
                                <label class="col-sm-2 col-form-label">Mensagem</label>
                                <div class="col-sm-10">
                                    {{$data->getbody()}}
                                </div>
                            </div>


                            <div class="card-footer">
                                <hr>
                            </div>
                        </div>
                        <div class="card-body ">
                            {!! Form::open(['route'=>['dash.contato.comment',$id],'method'=>'PUT','class'=>'form-horizontal']) !!}
                            <div class="row">
                                <label class="col-sm-2 col-form-label">Estado</label>
                                <div class="col-sm-10">
                                    <div class="form-group">
                                        {!! Form::select('status',['resolved'=>'resolvido','undefined'=>'Não Definido','notread'=>'Não lido'],$data->status,['class'=>'form-control']) !!}
                                    </div>
                                </div>
                            </div>

                            <div class="row">
                                <label class="col-sm-2 col-form-label">Comentário</label>
                                <div class="col-sm-10">
                                    <div class="form-group">
                                        <textarea name="comment" id="editor" cols="30" rows="10"
                                                  class="form-control">{{$data->comment}}</textarea>
                                    </div>
                                </div>
                            </div>

                            <div class="card-footer">
                                <button type="submit" class="btn btn-fill btn-rose">Enviar</button>
                            </div>
                            {!! Form::close() !!}
                            @can('contato-delete')
                                {!! Form::open(['route'=>['dash.contato.delete',$id],'method'=>'DELETE','class'=>'form-horizontal']) !!}
                                <div class="card-footer">
                                    <button type="submit" class="btn btn-fill btn-danger">Remover</button>
                                </div>
                                {!! Form::close() !!}
                            @endcan
                        </div>
                    </div>
                </div>


            </div>
        </div>
    </div>
@endsection

@push('js')
    <script src="//cdn.ckeditor.com/4.14.0/standard/ckeditor.js"></script>
    <script>
        CKEDITOR.replace('editor', {
            filebrowserUploadUrl: "{{route('dash.tutorial.upload', ['_token' => csrf_token() ])}}",
            filebrowserUploadMethod: 'form'
        });
    </script>
@endpush